/*
 * File:   F20.h
 * Author: jcrada
 *
 * Created on 30 May 2011, 1:03 PM
 */

#ifndef ECB_CEC10_F20_H
#define	ECB_CEC10_F20_H

#include "ecb/benchmarks/cec10/CecProblem.h" 

#include "ecb/benchmarks/cec10/CecMath.h"
#include "ecb/operator/Shifted.h"
#include "ecb/function/Rosenbrock.h"



namespace ecb {
    namespace cec10 {

        class F20 : public CecProblem {
        private:
            Function* rosenbrock;
        public:

            F20(int dimensions, int mValue)
            : CecProblem("F20", "Shifted Rosenbrock's Function", dimensions,
            -100, 100, true, mValue, new CecRandom(20l)) {

                std::vector<scalar> shift = CecMath::ShiftVector(dimensions, _properties->getMinimum(), _properties->getMaximum() - 1, randomizer());
                rosenbrock = new Shifted(shift, 0, new Rosenbrock());

            }

            ~F20() {
                delete rosenbrock;
            }

            scalar f(const std::vector<scalar>& x) {
                return rosenbrock->f(x);
            }
        };
    }
}


#endif	/* ECB_CEC10_F20_H */

